#include<bits/stdc++.h>
using namespace std;

bool isNum(int a,int b,int c)
{
	if((a*6==b*3)&&(a*6==c*2)&&(b*3==c*2))
	{
		return true;
	}
	return false;
}

int main()
{
	int a[10]={1,2,3,4,5,6,7,8,9};
	do
	{
		int num1=a[0]*100+a[1]*10+a[2];
		int num2=a[3]*100+a[4]*10+a[5];
		int num3=a[6]*100+a[7]*10+a[8];
		if(isNum(num1,num2,num3))
		{
			cout<<num1<<" "<<num2<<" "<<num3<<endl;
		}
	}while(next_permutation(a,a+9));
	return 0;
}
